// 导入七牛云
const qiniu = require("qiniu");
const accessKey = "NKy7PkLs40y128ZKptt9-jX0MvhnbjAk5CVeZgo3";
const secretKey = "1h6O-MrcRNAcQzEuPm2HAzaXJBNUl3Ym1-PzgBjX";
// 定义鉴权对象
const mac = new qiniu.auth.digest.Mac(accessKey, secretKey);
// 配置项
const options = {
  scope: "image-wsh",
  expires: 7200, //以秒为单位
};
const putPolicy = new qiniu.rs.PutPolicy(options);
const uploadToken = putPolicy.uploadToken(mac);
// 构建BucketManager对象
const config = new qiniu.conf.Config();
config.zone = qiniu.zone.Zone_z2;
const bucketManager = new qiniu.rs.BucketManager(mac, config);
module.exports = {
  uploadToken,
  bucketManager,
};
